import 'package:flutter/material.dart';

class LogoAppWidget extends StatefulWidget {
  @override
  _LogoAppWidgetState createState() => _LogoAppWidgetState();
}
class AnimatedLogo extends AnimatedWidget{
  AnimatedLogo({ Key key,Animation<double> animation }):super(key:key,listenable:animation);
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    final Animation<double> animation = listenable;
    return Center(
      child: Container(
        margin: EdgeInsets.symmetric(vertical: 10.0),
        height: animation.value,
        width: animation.value,
        child: Image.network("http://pic18.nipic.com/20111213/8791344_093424951000_2.jpg"),
      ),
    );
  }
}
class _LogoAppWidgetState extends State<LogoAppWidget> with SingleTickerProviderStateMixin {
  Animation<double> animation;
  AnimationController controller;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    controller = AnimationController(
      vsync: this,
      duration: Duration(seconds: 3),
    );
    animation = Tween<double>(begin: 0.0,end: 300.0).animate(controller);
    controller.forward();
  }
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    controller.dispose();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('动画Widget'),
      ),
      body: AnimatedLogo(animation: animation,)
    );
  }
}
